﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CDOP.Model;

namespace CDOP
{
    public partial class Home : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
                if (Session["LoggedUser"] == null)
                {
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    var user = (UserDetails)Session["LoggedUser"];
                    if (user.UserType.Type.ToLower() != "admin")
                        dvAdmin.Visible = false;
                }
        }

        protected void LnkBtnLogOutClick(object sender, EventArgs e)
        {
            Session["LoggedUser"] = null;
            Response.Redirect("Login.aspx");
        }
    }
}